This invention relates to distributed object systems using Common Object Request Broker Architecture (CORBA) and, more particularly, to a method and apparatus for implementing pre-marshaling and post-marshaling filters in an object request broker.
Software programs are continually becoming more complicated. Early programs consisted of straightforward procedural code that presented a simple, command line interface and text display to the user. These simple programs have gradually been replaced with complex programs that have graphical user interfaces and multiple features.
As programs have grown in complexity, the amount of effort which is required to write and debug the programs has also increased drastically. Consequently, major efforts have been made to reduce the amount of programming necessary to produce a modern, full-featured product. One of the most successful of these efforts has been the development of object-oriented programming in which programs are designed as collections of discrete elements called xe2x80x9cobjectsxe2x80x9d. The objects can be modified and reused in many cases, thereby reducing the development effort.
As will be understood by those skilled in the art, objects in the context of object-oriented programming are software entities comprising data and methods or operations on that data. The methods of an object collectively form an interface for manipulating the data in the object. The objects exist only at program runtime and are created, or instantiated, from object xe2x80x9cclassesxe2x80x9d which are actually written by the programmer. The class code written by a programmer can be xe2x80x9creusedxe2x80x9d by another programmer by instantiating objects from that code.
In order to further reduce the programming burden, distributed object systems have been developed in which methods in objects resident on a server can be executed or invoked remotely over a network from a client application. In this manner, the objects can be developed and maintained by a party different from the party that developed the client application. In such a system information is routed or streamed between the client and the server. This information includes requests from the client to invoke an object on the server and results and data from the method invocation returning from the server to the client. In addition, object-oriented programs often communicate by streaming objects from one program to another.
In such streaming operations, a stream writer organizes, or marshals, the information to form a serial data stream. The serial data stream is then sent to the server where a stream reader unmarshals the serial data stream to reconstruct a copy of the original information. The stream reader must operate such that the unmarshaling exactly xe2x80x9cundoesxe2x80x9d the effect of the marshaling so that the original information can be reconstructed. Ordinarily, such an operation does not present a problem, but when the stream reader is not written by the same author as the stream writer there can be incompatibilities.
In order to standardize the marshaling and unmarshaling and data transfer process, an industry consortium called the Object Management Group (OMG) was formed whose mission is to define a set of interfaces for inter-operable software. Its first specification, the Common Object Request Broker Architecture (CORBA) specification, is an industry consensus standard that hides all differences between programming languages, operating systems, and object location. The CORBA standard defines an object request broker (ORB) that handles the marshaling, transport and unmarshaling of information between applications. The ORB functions as a communication infrastructure, transparently relaying object requests across distributed heterogeneous computing environments. Inter-operability is accomplished through well-defined object interface specifications which allow client applications to connect to the ORB. CORBA provides an implementation independent notation for defining interfaces called the OMG Interface Definition Language (IDL).
The OMG CORBA specification defines an implementation independent object model which is actually built with a programming language, such as C++ or Java. In this model CORBA objects (also called xe2x80x9cservantsxe2x80x9d), which are implemented by servers, have references that can be exported to clients. Clients and servers are roles, not mutually exclusive tasks for a single program, so that any one program can be both a client and a server. Objects and object references are typically different programming language objects, although they do not have to be.
In a server, the implementation of an actual object which can be used to satisfy an invocation request on a CORBA object is generally both platform and language dependent and various models are possible for implementing objects in servers. The original CORBA standard defined a Basic Object Adapter (or BOA) which is a framework that adapts the server implementation to the implementation independent ORB. A newer OMG portability standard defines a Portable Object adapter (or POA), which replaces the BOA and is intended to be platform independent. Many ORBs also support other proprietary frameworks for implementing CORBA objects. All of these frameworks are commonly referred to as Object Adapters (or OAs).
In some cases, it may be useful to filter a client request before, and after, the marshaling and unmarshaling operations which occur during the delivery of the request from the client to the server. In addition, filtering can be performed before, and after, the marshaling and unmarshaling operations which occur during a reply when results of an invocation are returned from the server to the client. Filters can generally be classified into three categories: pre-marshaling filters, post-marshaling filters, and transform filters. These categories are based on the points in the method invocation process where the filters are applied. The pre and post filters are generally applied in the same order for the client and the server and the filters can be enabled and disabled to provide selective filtering.
Transform filters could be applied to the request, (a) on the client side after all pre/post filters have been applied, and (b) on the server side, before all pre/post filters have been applied to the request. Transform filters could be applied to the reply, (a) on server side after all pre/post filters have been applied to the reply message, and (b) on the client side before pre/post are applied to the reply message. The order in which the transform filters are invoked in one process are opposite of how they are invoked in the other process. Transform filters can also be enabled and disabled.
An application programmer might use the pre and post filters for a variety of reasons. For example, they could be used to log and print messages. They could also be used to send or retrieve extraneous information which does not appear in the request or reply messages. Filters could also be used for implementing simple transaction support without using the service context list, or for providing debugging support for the ORB. Transform filters can be useful for implementing such operations as encryption/decryption of data or data compression.
On the server side, the request and reply arguments are marshaled and unmarshaled in the implementation specific skeleton code. If the filters are enabled and require filtering of the marshaled or unmarshaled data, skeleton code needs to be generated which provides for filter invocation after the marshaling or unmarshaling operation. Therefore, different skeletons would need to be generated depending on the quality of servicexe2x80x94whether the request or reply was filterable or non-filterable. The result is proliferation of the skeleton code.
There is therefore a need to achieve different quality of service without requiring changes to the skeleton code for each different quality of service.
In accordance with the principles of the invention, the marshaling and unmarshaling process is encapsulated in a server invocation object created from a class which contains data, including the request ID, the marshal buffer and the marshal and unmarshal methods. Filtering is supported by extending the class with a subclass that overrides the marshal and unmarshal methods to invoke the filters at the proper points. During method invocation, the ORB examines the request to determine whether filtering is requested and instantiates an invocation object either from the parent class, if filtering is not requested, or from the subclass, if filtering is requested.